/* 主题变量 */
:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.65);
  --text: #0f172a;
  --muted: #475569;
  --brand: #0ea5e9;
  --brand-2: #22d3ee;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --border: rgba(2, 8, 23, 0.08);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --panel: rgba(17, 22, 34, 0.7);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
}

/* 基础 */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei";
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #0ea5e930 0%, transparent 70%),
              radial-gradient(800px 400px at 100% 0%, #22d3ee30 0%, transparent 70%),
              var(--bg);
}
.container { max-width: 1060px; margin: 0 auto; padding: 0 16px; }

/* 头部 */
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; filter: drop-shadow(0 6px 10px rgba(14,165,233,0.35)); }
.app-header h1 { margin: 0; font-size: 22px; letter-spacing: 0.2px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.header-actions { display: flex; gap: 8px; }

/* 按钮 */
.btn { cursor: pointer; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #0f172a; font-weight: 600; box-shadow: 0 1px 2px rgba(2,8,23,0.06); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(2,8,23,0.10); }
.btn.secondary { background: #eef2ff; color: #1e293b; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }

/* 搜索条 */
.search-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search-input-wrap { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; width: 100%; }
#searchInput {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(8px);
  font-size: 14px; outline: none;
}
#searchInput:focus { border-color: #93c5fd; box-shadow: 0 0 0 4px #93c5fd40; }
.result-count { font-size: 12px; color: var(--muted); }
.toolbar { display: flex; gap: 8px; }

/* 活跃筛选 */
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; font-size: 12px; }
.chip button { all: unset; cursor: pointer; padding: 0 2px; color: #0c4a6e; }

/* 筛选栅格 */
.filters { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 14px; padding: 12px 0; }
.filter-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px; box-shadow: 0 6px 18px rgba(2,8,23,0.10); }
.filter-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--text); }
.option { display: inline-flex; align-items: center; gap: 6px; margin: 6px 10px 6px 0; font-size: 13px; }

/* 结果列表 */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding: 16px 0 40px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 14px; box-shadow: 0 12px 28px rgba(2,8,23,0.12); overflow: hidden; }
.card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0)); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.tag { padding: 4px 8px; font-size: 12px; border-radius: 999px; background: #eef2ff; color: #1e40af; border: 1px solid #e0e7ff; }
.tag.good { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.tag.warn { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.tag.neutral { background: #e2e8f0; color: #0f172a; border-color: #cbd5e1; }
.meta { font-size: 12px; color: var(--muted); margin: 6px 0; }
.section-title { font-weight: 700; margin: 10px 0 6px; font-size: 13px; color: var(--text); }
.method, .caution, .dosage { white-space: pre-wrap; font-size: 13px; color: var(--text); }
.highlight { background: #fffbcc; }

/* 骨架屏 */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.skeleton-card { height: 180px; border-radius: 16px; background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 40%, #e5e7eb 80%); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { background-position: 0 0; } 100% { background-position: 320px 0; } }

/* 底部 */
.footer { padding: 18px 0 26px; font-size: 12px; color: var(--muted); }
.footer .notice { margin-bottom: 8px; }

/* 响应式 */
@media (max-width: 720px) {
  .filters { grid-template-columns: 1fr; }
  .search-bar { flex-direction: column; align-items: stretch; }
}